package cn.bearspark.user.enumeration;

import cn.bearspark.common.dto.ResponseDTO;

/**
 * 用户模块的失败响应的枚举类
 *
 * @author f
 */
public enum UserFailRespEnum {
    PHONE_EXIST(301, "手机号已存在"),
    NOT_EXIST_USER(302, "用户不存在");

    /**
     * 返回一个 T 类型的失败响应
     */
    public <T> ResponseDTO<T> response() {
        return ResponseDTO.fail(this.code, this.msg);
    }

    private final int code;
    private final String msg;

    UserFailRespEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
